import Vue from 'vue'
import router from '../router'
import { Toast } from 'vant';

// 全局路由守卫
router.beforeEach((to, from, next) => {
    if (to.matched.some(m => m.meta.auth)) {
        if (sessionStorage.getItem('code') == 2000) {
            next()
        } else if (to.path !== '/') {
            next({ path: '/user/register' })
            Toast('请先绑定手机号');
        }
    } else {
        next()
    }
});